package com.pine.manager.pineframework.trigger;

import com.pine.common.beans.pineframework.request.SysDictItemSaveOrUpdateRequest;
import com.pine.common.beans.request.BatchIdRequest;
import com.pine.common.beans.response.DeleteResponse;
import com.pine.common.trigger.TriggerContext;
import com.pine.common.trigger.TriggerUtil;
import com.pine.manager.core.TriggerTypeEnum;

/**
 * <p>
 * 系统字典项表 触发器管理类
 * </p>
 *
 * @author pine manage
 * @since 2024-08-16
 */
public class SysDictItemTriggerManager {

    /**
     * 新增或修改
     *
     * @param request 请求体
     * @return 响应体
     */
    public static Boolean saveOrUpdate(SysDictItemSaveOrUpdateRequest request) {
        TriggerContext<SysDictItemSaveOrUpdateRequest> triggerContext = new TriggerContext<>(TriggerTypeEnum.SYS_DICT_ITEM_SAVE_OR_UPDATE, request);
        return TriggerUtil.triggerWithLock(triggerContext);
    }

    /**
     * 删除
     *
     * @param request 请求体
     * @return 响应体
     */
    public static DeleteResponse delete(BatchIdRequest<Long> request) {
        TriggerContext<BatchIdRequest<Long>> triggerContext = new TriggerContext<>(TriggerTypeEnum.SYS_DICT_ITEM_DELETE, request);
        return TriggerUtil.triggerWithLock(triggerContext);
    }
}
